package router

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"

	"kstar-gf-api/app/admin/controller"
	"kstar-gf-api/app/middleware"
)

func init() {

	s := g.Server()

	// 路由注册
	s.Group("/admin/auth", func(group *ghttp.RouterGroup) {

		group.Group("/", func(group *ghttp.RouterGroup) {
			group.Bind(
				controller.AuthApi.GetOssSignature,
				controller.AuthApi.Login,
			)
		})

		// 需要登录的接口
		group.Middleware(middleware.MiddlewareAdminLoginHandler)
		group.Group("/", func(group *ghttp.RouterGroup) {
			group.Bind(
				controller.AuthApi.LoginTenant,
				controller.AuthApi.Logout,
			)
		})

		// 需要登录学校的接口
		group.Middleware(middleware.MiddlewareAdminLoginHandler)
		group.Middleware(middleware.MiddlewareAdminLoginSchoolHandler)
		group.Group("/", func(group *ghttp.RouterGroup) {
			group.Bind()
		})
	})
}
